﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ExportToRTR.CApExportToRTRFixedObject
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using DnProcessSimulateCommands.ExportToRTR.YAML;
using System.Collections.Generic;
using System.IO;
using Tecnomatix.Engineering;


namespace DnProcessSimulateCommands.ExportToRTR{

public abstract class CApExportToRTRFixedObject : CApExportToRTRExporter, ICApExportToRTRWriteable
{
  internal const string CAD = "cad";
  private string m_name;
  private HashSet<ITxObject> m_geometries;

  internal List<ITxObject> Static3D { get; set; } = new List<ITxObject>();

  public CApExportToRTRFixedObject(
    string name,
    HashSet<ITxObject> geometries,
    string root,
    string parentLink,
    string directoryName)
    : base(root, parentLink, directoryName)
  {
    this.m_name = CApExportToRTRUtils.GetUniqueName(name);
    this.m_geometries = geometries;
  }

  public void Write(CApExportToRTRXmlWriter writer)
  {
    this.m_directory = "cad";
    if (!Directory.Exists(Path.Combine(this.m_root, this.m_directory)))
      Directory.CreateDirectory(Path.Combine(this.m_root, this.m_directory));
    foreach (ITxObject geometry in this.m_geometries)
    {
      if (this.Export(geometry as ITxLocatableObject) != "emptyLink")
        this.Static3D.Add(geometry);
    }
  }

  protected override void CreateMate(ITxLocatableObject obj, ObjectInstance yamlObject)
  {
    CApExportToRTRYamlMgr.Instance.CreateMateToReferenceFrame(obj, (IObjectInstance) yamlObject);
  }
}
